package com.manong.mapper;

import com.manong.domain.Warehouse;
import com.manong.query.QueryObject;
import com.manong.query.WarehouseQueryObject;
import com.manong.vo.GoodsWarehouseVo;
import io.lettuce.core.dynamic.annotation.Param;

import java.math.BigDecimal;
import java.util.List;

public interface WarehouseMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Warehouse record);

    Warehouse selectByPrimaryKey(Integer id);
    // 新方法：查询仓库及商品库存
    Warehouse selectWarehouseWithGoods(Integer id);

    List<Warehouse> selectAll();

    List<Warehouse> selectForList(WarehouseQueryObject qo);

    int updateByPrimaryKey(Warehouse record);

    int increaseUsedSpace(@Param("warehouseId") Integer warehouseId, @Param("occupancy") BigDecimal occupancy);

    // 减少仓库已用空间（新增方法）
    int decreaseUsedSpace(@Param("warehouseId") Integer warehouseId,
                          @Param("occupancy") BigDecimal occupancy);

    List<Warehouse> selectByManager(Integer manager);

    List<GoodsWarehouseVo> getGoodsInWarehouse(Integer warehouseId);
}